package qingke_shop;

import java.io.IOException;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

public class Crawler {

	public static void main(String[] args) {
		String url="https://search.jd.com/Search?keyword=耐克&enc=utf-8&wq=naike&pvid=26c3157684934bb9834048127e164b33";
		try {
			Document d =Jsoup.connect(url).get();
			//System.out.println(d);
			List<Element> elements=d.select("#J_searchWrap #J_container #J_main	#J_goodsList ul.gl-warp li.gl-item div.gl-i-wrap div.p-price strong");
			List<Element> elements2=d.select("div.gl-i-wrap");
			for(Element element:elements2){
			//	System.out.println(element.attr("data-price"));
				System.out.println(element.select("div.p-name a").attr("title"));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
